import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

// import {Message} from "element-ui"
// Vue.use(Message)

import '@/styles/index.scss' // global css

import '@/styles/fp.css' // global css

import JsonExcel from 'vue-json-excel'
Vue.component('downloadExcel', JsonExcel)

//  引入Echarts
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

import clipboard from 'clipboard';
Vue.prototype.clipboard = clipboard

import waterfall from 'vue-waterfall2'
Vue.use(waterfall)

import Blob from './excal/Blob.js'
// import Export2Excel from './excal/Export2Excel'

import VueQuillEditor from 'vue-quill-editor'//调用编辑器

// import ImageResize from 'quill-image-resize-module' , { Quill }  
// Quill.register('modules/imageResize', ImageResize)
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor)


import 'element-ui/lib/theme-chalk/base.css';
// collapse 展开折叠
import CollapseTransition from 'element-ui/lib/transitions/collapse-transition';
Vue.component(CollapseTransition.name, CollapseTransition)

if (process.env.NODE_ENV === 'production') {
  // mockXHR()
}


// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.config.productionTip = false

import 'fullpage.js/vendors/scrolloverflow.js' // Optional. When using scrollOverflow:true
import '@/icons/iconfont.js'
import VueFullPage from 'vue-fullpage.js'
Vue.use(VueFullPage);

// ElementUI.Dialog.props.closeOnClickModal.default = false; 

router.afterEach((to, from, next) => {
  window, scrollTo(0, 0)
})

router.beforeEach((to, from, next) => {
  next();
  if (from.path == '/report' || from.path == '/patentDetails' || from.path == '/compdetail' || from.path == '/cutDetails' || from.path == '/docking' || from.path == '/AdvancedSearch' || from.path == '/costdetails' || from.path == '/web/enterprise') {
    sessionStorage.setItem("url", from.fullPath);
    sessionStorage.setItem("path", from.path);
    sessionStorage.setItem("name", from.meta.title);
  }
  if (!( to.path == '/detail' || to.path == '/AdvancedSearch' || to.path == '/web/enterprise' || to.path == '/docking')) {
    sessionStorage.removeItem('leng')
    sessionStorage.removeItem('list')
    sessionStorage.removeItem('list_page')
    sessionStorage.removeItem('exp')
  }
})

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
